<style>
    .add-msg .add-forma{
        float: left;
    }
    .add-forma .add-ipt button {
        float: right;
    }
</style>


<include file="common:__head__"/>
<div class="permissions-tabs">
    <a class="role tabs-bg" href="{:U('Order/return_list')}">全部</a>
</div>
<div class="permissions-content">
    <div class="permissions-le">
        <div class="add-msg">
            <div class="add-form add-forma">
                <form method="post" action="{:U('Order/return_list')}" onSubmit="return check_form();">

                    <select class="select" name="order_status" size="1">
                        <option value="0">请选择状态</option>
                        <option value="3">未通过</option>
                        <option value="2">通过</option>
                        <option value="1">待审核</option>
                    </select>

                    <input placeholder="开始时间" type="text" readonly name="start_time" id="start_time" class="search-ipt" value="{$data['start_time']}" />
                    <input placeholder="结束时间" type="text" readonly name="end_time" id="end_time" class="search-ipt" value="{$data['end_time']}" />

                    <div class="add-ipt">
                        <input placeholder="订单编号" type="text" name="order_num" value="{$data['order_num']}" />
                        <button name="btn" value="1" id="btn"></button>
                    </div>
                </form>
            </div>
        </div>
        <div class="permissions-table">
            <table border="0" width="100%">
                <thead>
                <tr>
                    <td width="15%">订单编号</td>
                    <td>商品ID</td>
                    <td>下单人</td>
                    <td>联系电话</td>
                    <td>物流费用</td>
                    <td>申请退款时间</td>
                    <td>退款小计</td>
                    <td>处理状态</td>
                    <td>操作</td>
                </tr>
                </thead>
                <tbody>
                <volist name="order_info" id="vo" key="k">
                    <tr>
                        <td>{$vo.t_order_id}</td>
                        <td>{$vo.good_id}</td>
                        <td>{$vo.name}</td>
                        <td>{$vo.user_phone}</td>
                        <td>{$vo.send_type}</td>
                        <td>{$vo.back_time}</td>
                        <td>{$vo.back_sum}</td>
                        <td>
                            <if condition="$vo.back_status eq 1">
                                待审核
                            </if>

                            <if condition="$vo.back_status eq 2">
                                <label style="color:green;">通过</label>
                            </if>

                            <if condition="$vo.back_status eq 3">
                                <label style="color:red;">未通过</label>
                            </if>
                        </td>
                        <td>
                            <a href="{:U('Order/return_good_info',array('order_id'=>$vo['order_id'],'good_id'=>$vo['good_id']))}" class="btn btn-blue">查看</a>
                        </td>
                    </tr>
                </volist>
                </tbody>
            </table>
            {$page}
        </div>
    </div>
    <div class="permissions-ri">
        <a href="" class="permissions-help">帮助和服务</a>
    </div>
</div>
<script type="text/javascript" src="__PUBLIC__/usr/js/layer/laydate/laydate.js"></script>
<include file="common:__foot__"/>
<script type="text/javascript">

    function check_form(){
        var start_time = $.trim($('#start_time').val());
        var end_time =  $.trim($('#end_time').val());

        var start_timestamp = Date.parse(new Date(start_time));
        start_timestamp = start_timestamp / 1000;

        var end_timestamp = Date.parse(new Date(end_time));
        end_timestamp = end_timestamp/1000;

        if(start_timestamp > end_timestamp){
            layer.msg("开始时间必须大于结束时间");return false;
        }
        if(start_time == '' ^ end_time == ''){
            layer.alert('请选择完整的时间间隔');
            return false;
        }
        return true;
    }

    $(function() {
        $('#start_time').layDate();
        $('#end_time').layDate();

        $("#btn").click(function () {
            $("#form_data").submit();
        })
    });
</script>